local log = require("core.log")
local pcall = pcall
local pairs = pairs
local error = error
local _M = {}

function _M.call(modules, method_name, ...)
    for _, m in ipairs(modules) do

        local func = m[method_name]
        if not func then
            log.debug("can not found module method, ", m, ".", method_name)
            goto CONTINUE
        end
        local ok, err = pcall(func, ...)
        if not ok then
            log.error("call error: " .. m .. ", " .. method_name .. " - " .. err)
            --error("call error: " .. m .. ", " .. method_name .. " - " .. err)
        end

        ::CONTINUE::
    end
end

return _M
